﻿@model G28BS.ViewModels.GameDetailsViewModel

@{
    ViewBag.Title = "GameDetails";
}
<div class="float-left">
    <div id="textBody">
        <h2>@Model.game.name</h2>

        <div id="screenshot">
            <img src="@Model.game.screenshot" />
        </div>

        <div id="gameDescription">
            <h3>Description</h3>

            <p>@Model.game.longDescription</p>
        </div>

        <div id="gameRules">
            <h3>Rules</h3>

            <p>@Model.game.rules</p>
        </div>
    </div>

    <div id="gameStatistics">
        <div id="stats">
            <table>
                <caption>Statistics</caption>
                <tr>
                    <td>todo</td>
                </tr>
            </table>
        </div>

        <div id="topPlayers" class="float-right">
            <table>
                <caption>Top Players</caption>
                <tr>
                    <td>todo</td>
                </tr>
            </table>
        </div>
    </div>
</div>

<div id="contentSidebar" class="float-right">
    <div id="video">
        <iframe width="420" height="236" src="@Model.game.video"></iframe>
    </div>

    <div id="gameDetails">
        <h3>Details</h3>
        
        <p>Number of players: @Model.game.minPlayers - @Model.game.maxPlayers</p>

        <p>Playing time: @Model.game.playingTime</p>

        <a href="@Url.Action("Create", "GameRoom", new { id=Model.game.gameID })"><img src="/Images/playbutton.png" alt="Create a new game room."></a>
    </div>

    <div id="openGames">
        <h3>Open games, click to join</h3>
        <ul class="emptyRoomList">
            @foreach (var room in Model.waitingGames) {
            <li style="list-style-image:url(@Model.game.icon)">
                @room.gameRoomName
                @{var emptySlots = (from x in room.slots where x.occupied == false select x).ToList().Count();
                                            @:@emptySlots / @Model.game.maxPlayers
                } 
                <a href="@Url.Action("Join", "GameRoom", new { id=room.gameRoomID })"><img src="/Images/playbutton.png" class="playButton" alt="Join this game."/></a>
            </li>
            }
        </ul>
    </div>
</div>